import fetch from "isomorphic-fetch"

function downloadSync(filePath) {
	fetch(filePath, {
		method: 'GET',
		credentials: 'include',
	}).then((response) => {
		response.blob().then(blob => {
			//TODO
		})
	}).catch((error) => {
		console.log(error)
	})
}


function download(filePath) {
	let ele = document.createElement("a")
	ele.setAttribute("href", filePath)
	ele.setAttribute("download", "")
	ele.click()
}

export default download
export {downloadSync}